home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: Parent Power / The Sunday Times - Parent Power.iso / pc / engine / map.swf / scripts / DefineSprite_227 / frame_1 / DoAction.as
Encoding:
Text File  |  2005-10-31  |  1.1 KB  |  53 lines

  1. stop();
  2. _visible = false;
  3. LEAmap.oBroadcaster.addListener(this);
  4. SCROLL_FACTOR = 5;
  5. left_btn.onPress = function()
  6. {
  7.    startScroll(-1,0);
  8. };
  9. right_btn.onPress = function()
  10. {
  11.    startScroll(1,0);
  12. };
  13. up_btn.onPress = function()
  14. {
  15.    startScroll(0,-1);
  16. };
  17. down_btn.onPress = function()
  18. {
  19.    startScroll(0,1);
  20. };
  21. left_btn.onRelease = left_btn.onReleaseOutside = right_btn.onRelease = right_btn.onReleaseOutside = up_btn.onRelease = up_btn.onReleaseOutside = down_btn.onRelease = down_btn.onReleaseOutside = function()
  22. {
  23.    stopScroll();
  24. };
  25. startScroll = function(x, y)
  26. {
  27.    nmXScrollBy = SCROLL_FACTOR * x * -1;
  28.    nmYScrollBy = SCROLL_FACTOR * y * -1;
  29.    this.onEnterFrame = function()
  30.    {
  31.       _parent.map_mc._x += nmXScrollBy;
  32.       _parent.map_mc._y += nmYScrollBy;
  33.    };
  34. };
  35. stopScroll = function()
  36. {
  37.    delete this.onEnterFrame;
  38. };
  39. onZoomChange = function(nmS)
  40. {
  41.    _visible = nmS != 100 ? true : false;
  42. };
  43. onShowDetailMap = function()
  44. {
  45.    gotoAndStop("l_fade_out");
  46.    play();
  47. };
  48. onHideDetailMap = function()
  49. {
  50.    gotoAndStop("l_fade_up");
  51.    play();
  52. };
  53.